package org.example.product.service.impl;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.example.product.bean.Product;
import org.example.product.mapper.ProductMapper;
import org.example.product.service.ProductService;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * @Author : wer
 * @Date: 2025/6/21 12:55
 * @Description: 商品服务接口实现
 */

@Service
public class ProductServiceImpl implements ProductService {


    @Resource
    private ProductMapper productMapper;

    @Override
    public Product getProductById(Long productId) {

//        // 模拟超时or延迟
//        try {
//            TimeUnit.SECONDS.sleep(2);
//        } catch (InterruptedException e) {
//            throw new RuntimeException(e);
//        }

//        // 模拟异常
//        int i = 10/0

        return productMapper.getProductsById(productId);
    }
}
